#include <stdio.h>

#define IN 1 /* 单词内 */
#define OUT 0 /* 单词外 */

int main() {
    int c, nl, nw, nc;
    int state = OUT; /* 默认在单词外 */
    nl = nw = nc = 0;
    while ((c = getchar()) != EOF) {
        ++nc;
        if (c == '\n') ++nl;
        if (c == ' ' || c == '\n' || c == '\t')
            state = OUT;
        else if (state == OUT) {
            state = IN;
            ++nw;
        }
    }
    printf("line: %d, words: %d, char count: %d.\n", nl, nw, nc);
    return 0;
}
